From 100f5738dcf45d4ca2ec7224e728b16690ac52a8 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 9 Mar 2009 09:56:16 +0000 Subject: [PATCH] Avoid deadlock in tasklet_schedule() after console_force_unlock(). Signed-off-by: Keir Fraser --- xen/drivers/char/console.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 00a32022dd..f6ce51aad8 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -420,6 +420,8 @@ long do_console_io(int cmd, int count, XEN_GUEST_HANDLE(char) buffer) * ***************************************************** */ +static bool_t console_locks_busted; + static void __putstr(const char *str) { int c; @@ -429,10 +431,12 @@ static void __putstr(const char *str) sercon_puts(str); vga_puts(str); - while ( (c = *str++) != '\0' ) - putchar_console_ring(c); - - tasklet_schedule(¬ify_dom0_con_ring_tasklet); + if ( !console_locks_busted ) + { + while ( (c = *str++) != '\0' ) + putchar_console_ring(c); + tasklet_schedule(¬ify_dom0_con_ring_tasklet); + } } static int printk_prefix_check(char *p, char **pp) @@ -665,6 +669,7 @@ void console_force_unlock(void) { spin_lock_init(&console_lock); serial_force_unlock(sercon_handle); + console_locks_busted = 1; console_start_sync(); } -- 2.30.2